<?php
	defined( '_JEXEC' ) or die( 'Restricted access' );
	jimport('joomla.application.component.view');
	class SocialRoutesViewCreation extends JView
	{
		var $_option = null;
		
		function display($tpl = null)
		{
			$option=JRequest::getCmd('option');
			$this->assignRef('option', $option);
			
			$this->addCSS();
			$this->addJavascripts();
			
			parent::display($tpl);
		}
		
		private function addCSS(){
			$option=JRequest::getCmd('option');
			
			$document = &JFactory::getDocument();
			$document->addStyleSheet('components/'.$option.'/css/socialroutes.css');
		}
		
		private function addJavascripts(){
			$option=JRequest::getCmd('option');
			$jsPath='components/'.$option.'/js/';
			
			$document = &JFactory::getDocument();
			$document->addScript( 'http://maps.google.com/maps/api/js?sensor=false' );
			$document->addScript( 'https://www.google.com/jsapi' );
			$document->addScript( $jsPath.'jquery-1.5.1.min.js' );
			$document->addScript( $jsPath.'routeCommons.js' );
			$document->addScript( $jsPath.'routeCreation.js' );
			
			$this->addTraducCommonJavascript();
		}
		
		private function addTraducCommonJavascript(){
			?>
			<script>
				<?php 
				echo "\n var R_COMMON_ELEVATION='".JText::_('R_COMMON_ELEVATION')."';";
				echo "\n var R_COMMON_MAXELEV='".JText::_('R_COMMON_MAXELEV')."';";
				echo "\n var R_COMMON_MINELEV='".JText::_('R_COMMON_MINELEV')."';";
				echo "\n var R_COMMON_DISTANCE='".JText::_('R_COMMON_DISTANCE')."';";
				echo "\n var R_COMMON_TIME='".JText::_('R_COMMON_TIME')."';";
				echo "\n var R_COMMON_DAY='".JText::_('R_COMMON_DAY')."';";
				echo "\n var R_COMMON_DAYS='".JText::_('R_COMMON_DAYS')."';";
				echo "\n var R_COMMON_MINUTES='".JText::_('R_COMMON_MINUTES')."';";
				echo "\n var R_COMMON_HOURS='".JText::_('R_COMMON_HOURS')."';";
				echo "\n var R_COMMON_HOUR='".JText::_('R_COMMON_HOUR')."';";
				echo "\n var R_COMMON_AND='".JText::_('R_COMMON_AND')."';";
				?>
			</script>
			<?php 
		}
	}
?>